package com.xgkj.diyiketang.task;

import com.alibaba.fastjson.JSONObject;
import com.xgkj.diyiketang.http.CouponHttpRequest;
import com.xgkj.diyiketang.http.CouponHttpResponse;
import com.xgkj.diyiketang.http.engine.CouponHttpBaseTask;
import com.xgkj.diyiketang.http.engine.TaskResultCode;

/**
 * Created by Administrater on 2015/12/7.
 */
public class FaBuGongGaoTask extends CouponHttpBaseTask {
    private String mTitle;
    private String mCommentContent;
    private String mUrl;

    public FaBuGongGaoTask(String msgTitle, String msgContent, String msgUrl) {
        super(TaskType.FABUGONGGAO_TASK);
        mTitle = msgTitle;
        mCommentContent = msgContent;
        mUrl = msgUrl;
    }

    @Override
    protected void processResponseData(CouponHttpResponse response) {
        notifyTaskCompleted(TaskResultCode.SUCCESS, null);
    }

    @Override
    protected void prepareRequest() {
        super.prepareRequest();
        if (mPhase == TASK_PHASE_INIT) {
            CouponHttpRequest request = new CouponHttpRequest(RequestType.FABUGONGGAO_REQUEST);
            JSONObject json = new JSONObject();
            json.put("msgTitle", mTitle);
            json.put("msgContent", mCommentContent);
            json.put("msgUrl",mUrl);
            request.setData(json.toString());
            request.setApiNo(ApiNo.FABUGONGGAO);
            addRequest(request);
        }
    }

}
